﻿using System;

namespace CodeRecipes
{
    class Program
    {
        static void Main(string[] args)
        {
            var queue = new CircularQueue<int>(5);
            for (int i = 1; i < 7; i++)
            {
                if (queue.Enqueue(i))
                {
                    Console.WriteLine("Enqueued: {0}", i);
                }
                else
                {
                    Console.WriteLine("Couldn't enqueue: {0}", i);
                }
            }
            queue.Show();

            for (int i = 1; i < 5; i++)
            {
                var dq = queue.Dequeue();
                Console.WriteLine("Dequeued: {0}", dq);
            }

            queue.Show();


            queue.Enqueue(7);
            Console.WriteLine("Enqueued: {0}", 7);
            queue.Enqueue(8);
            Console.WriteLine("Enqueued: {0}", 8);
            queue.Show();

            for (int i = 1; i < 4; i++)
            {
                var item = queue.Dequeue();
                Console.WriteLine("Dequeued: {0}", item);
            }
            queue.Dequeue();
            queue.Show();
        }
    }
}
